<?php
$colname_tampil_member = "-1";
if (isset($_GET['user'])) {
  $colname_tampil_member = $_GET['user'];
}
mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_tampil_member = sprintf("SELECT * FROM memberdb WHERE nama_user = %s", GetSQLValueString($colname_tampil_member, "text"));
$tampil_member = mysql_query($query_tampil_member, $sepolwan_connect) or die(mysql_error());
$row_tampil_member = mysql_fetch_assoc($tampil_member);
$totalRows_tampil_member = mysql_num_rows($tampil_member);

mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_ikut = "SELECT * FROM ikut WHERE dari = '".$row_sesi_member['id']."' AND ke = '".$row_tampil_member['id']."'";
$ikut = mysql_query($query_ikut, $sepolwan_connect) or die(mysql_error());
$row_ikut = mysql_fetch_assoc($ikut);
$totalRows_ikut = mysql_num_rows($ikut);

mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_folowing = "SELECT * FROM ikut WHERE dari = '".$row_tampil_member['id']."'";
$folowing = mysql_query($query_folowing, $sepolwan_connect) or die(mysql_error());
$row_folowing = mysql_fetch_assoc($folowing);
$totalRows_folowing = mysql_num_rows($folowing);

mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_folowers = "SELECT * FROM ikut WHERE ke = '".$row_tampil_member['id']."'";
$folowers = mysql_query($query_folowers, $sepolwan_connect) or die(mysql_error());
$row_folowers = mysql_fetch_assoc($folowers);
$totalRows_folowers = mysql_num_rows($folowers);
?>
<?php if ($totalRows_tampil_member > 0) { // Show if recordset not empty ?>
<?php if ($_GET['idart']=="") { ?>
  <div style="width:100%" align="center"><div style="border-left:1px solid #CCC; border-right:1px solid #CCC; width:950px; height:300px; background:center url(<?php if ($row_tampil_member['cover_profile']<>NULL) { if(file_exists("images/member/cover/resize_950_310_".$row_tampil_member['cover_profile'])) { echo $base."images/member/cover/resize_950_310_".$row_tampil_member['cover_profile']; } else { if(file_exists("images/member/cover/".$row_tampil_member['cover_profile'])) { echo $base."images/member/cover/tester_950_310_".$row_tampil_member['cover_profile']; } else { echo $base."images/member/cover/resize_950_310_default.jpg"; } } } else echo $base."images/member/cover/resize_950_310_default.jpg"; ?>); padding-top:10px;">
  <div style="width:120px; height:120px; padding:5px; background:#FFF;"><img src="<?php if ($row_tampil_member['foto_profile']<>NULL) { if(file_exists("images/member/ava/resize_120_120_".$row_tampil_member['foto_profile'])) { echo $base."images/member/ava/resize_120_120_".$row_tampil_member['foto_profile']; } else { if(file_exists("images/member/ava/".$row_tampil_member['foto_profile'])) { echo $base."images/member/ava/tester_120_120_".$row_tampil_member['foto_profile']; } else { echo $base."images/member/ava/resize_120_120_default.jpg"; } } } else echo $base."images/member/ava/resize_120_120_default.jpg"; ?>" ></div>
  <h2><a href="<?php echo $base ?><?php echo $row_tampil_member['nama_user']; ?>" style=" text-shadow:
   -1px -1px 0 #fff,  
    1px -1px 0 #fff,
   -1px  1px 0 #fff,
    1px  1px 0 #fff;"><?php echo $row_tampil_member['full_name']; ?> (<?php echo $row_tampil_member['nama_user']; ?>)</a></h2>
	<span style=" text-shadow:
   -1px -1px 0 #fff,  
    1px -1px 0 #fff,
   -1px  1px 0 #fff,
    1px  1px 0 #fff;"><?php echo $row_tampil_member['about']; ?><br />
<?php echo $row_tampil_member['tempat']; ?>  <?php echo $row_tampil_member['website']; ?><br />
<?php if ($row_tampil_member['id']<>$row_sesi_member['id'] and $totalRows_ikut==0) { ?><form <?php if($row_sesi_member['id']<>''){ ?> action="<?php echo $base.$row_tampil_member['nama_user'] ?>" <?php } else {?>  action="<?php echo $base."login.php" ?>"  <?php } ?> method="post" name="okikut" >
<input name="ke" type="hidden" value="<?php echo $row_tampil_member['id'] ?>" />
<input name="okikut" type="submit" value="Follow" /><input name="Button"  onclick="javascript:kirimpesan()"  type="button" value="Messages" /></form> <?php } else if ($row_tampil_member['id']<>$row_sesi_member['id'] and $totalRows_ikut>0) {  ?>
<form action="<?php echo $base.$row_tampil_member['nama_user'] ?>" method="post" name="delikut" >
<input name="ke" type="hidden" value="<?php echo $row_tampil_member['id'] ?>" />
<input name="delikut" type="submit" value="Following" style="background: #036; color: #FFF" /><input name="Button" onclick="javascript:kirimpesan()"  type="button" value="Messages" /></form>
<?php } ?>
</span>
  </div></div>
  <div style="width:100%" align="center">
    <div id="propil">
    <table width="950" height="50" cellpadding="0" cellspacing="0" border="0" >
    	<tr>
        	<td valign="middle" align="center"><a href="<?php echo $base ?><?php echo $row_tampil_member['nama_user']; ?>">Timeline</a> <a href="<?php echo $base ?><?php echo $row_tampil_member['nama_user']; ?>/following">Following ( <?php mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_ceking = "SELECT * FROM ikut WHERE dari = $row_tampil_member[id] and ke = $row_tampil_member[id] ";
$ceking = mysql_query($query_ceking, $sepolwan_connect) or die(mysql_error());
$row_ceking = mysql_fetch_assoc($ceking);
$totalRows_ceking = mysql_num_rows($ceking);

if ($totalRows_ceking >0) { echo $totalRows_folowing-1; }  else { echo $totalRows_folowing; } 
mysql_free_result($ceking); ?> )</a> <a href="<?php echo $base ?><?php echo $row_tampil_member['nama_user']; ?>/followers">Followers ( <?php mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_ceking = "SELECT * FROM ikut WHERE dari = $row_tampil_member[id] and ke = $row_tampil_member[id] ";
$ceking = mysql_query($query_ceking, $sepolwan_connect) or die(mysql_error());
$row_ceking = mysql_fetch_assoc($ceking);
$totalRows_ceking = mysql_num_rows($ceking);

if ($totalRows_ceking >0) { echo $totalRows_folowers-1; }  else { echo $totalRows_folowers; } 
mysql_free_result($ceking); ?> )</a> <?php if ($_SESSION['MM_Username']<>"" and $_SESSION['MM_Username']==$row_tampil_member['email']) { ?> <a href="<?php echo $base ?><?php echo $row_tampil_member['nama_user']; ?>/edit">Edit Acount</a><?php } ?>
            </td>
        </tr>
    </table></div>
  </div>
  <?php } ?>
  <?php } // Show if recordset not empty ?>
<?php
mysql_free_result($tampil_member);
mysql_free_result($ikut);
mysql_free_result($folowing);
mysql_free_result($folowers);
?>
